package org.ansel.webnodb.demo.service;

import java.util.Map;

import com.alibaba.fastjson.JSONArray;
import org.ansel.webnodb.demo.beans.Demoperson;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Service;



@Service
public class DemoService {
	private static final Logger logger = LoggerFactory.getLogger(DemoService.class);
	@Value("${demoperson.name}")
	private String demopersonname;
	@Value("${demoperson.age}")
	private Integer age;
//	@Value("${demoperson.pets.dog}")
	private Map<String,Object> dog;
//	@Value("${demoperson.children}")
	private String[] children;
	@Value("${demoperson.parents}")
	private String[] parents;
	@Autowired
	private Demoperson demoperson;

	public void testProp() {
		logger.info("String demopersonname is "+demopersonname);
		logger.info("Integer age is "+age);
//		logger.info("Map dog is "+dog.toString());
//		logger.info("Array children is "+String.join(",", parents));
		logger.info("Array parents is "+String.join(",", parents));
		logger.info("Map is "+demoperson.getMap().toString());
		logger.info("List is "+ JSONArray.toJSONString(demoperson.getList()));
	}
}
